package com.yourname.myapplication.data.local.converters

import androidx.room.TypeConverter
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.Json

class ListConverter {
        @TypeConverter
        fun fromList(list: List<String>): String {
                return Json.encodeToString(ListSerializer(String.serializer()),list)
        }
        @TypeConverter
        fun toList(json: String): List<String> {
                return Json.decodeFromString(
                        ListSerializer(String.serializer()),json)
        }
}